home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.3 / Video Toaster v4.3.iso / 3.1 / toasterall / arexx_examples / tpaint / tplaser.rexx < prev    next >
OS/2 REXX Batch file  |  1993-05-13  |  3KB  |  116 lines

  1. /* TP Animate Beam! */
  2. /* © 1993 NewTek, Inc.    by Arnie Cachelin */
  3.  
  4. PARSE ARG x1 y1 x2 y2 frames savename startframe loadname
  5.  
  6. if x1="" | x2="" | y2="" | y1="" | frames="" | savename="" then do
  7.   say "Usage: rx TPLaser x1 y1 x2 y2  frames savename [startframe [loadname]]"
  8.   exit
  9. end
  10.  
  11. Address "DigiPaint"     /* Tell ARexx where commands go  */
  12. if pos("DigiPaint",show(ports))=0 then do
  13.   say "Can't find ToasterPaint!"
  14.   exit
  15.   end
  16.  
  17. if startframe="" then startframe=0
  18.  
  19. 'Mine'          /* Set Edge transparency to 0% */
  20. 'Midc'          /* Set Center transparency to 50% */
  21. 'Pmcl'          /* Set to normal paint mode */
  22. 'Bsmo'
  23. 'Hvon'
  24. xstep=((x2-x1)/frames)
  25. ystep=((y2-y1)/frames)
  26. pulselen=4
  27. do i=1 to frames+pulselen
  28.   if loadname ~="" then say 'Call LoadRGB('loadname||right(i+startframe,3,"0")')'
  29.   if loadname ~="" then Call LoadRGB(loadname||right((i+startframe),3,"0"))
  30.   dx=(i*xstep)%1
  31.   dy=(i*ystep)%1
  32.   pulse=(i-pulselen)
  33.   if pulse>0 then do
  34.     px=(pulse*xstep)%1
  35.     py=(pulse*ystep)%1
  36.     x=x1 + px
  37.     y=y1 + py
  38.     say 'Pulse End:' pulse px py x y dx dy
  39.     end
  40.   else do
  41.         x=x1
  42.         y=y1
  43.     say x y
  44.   end
  45.   'Pend' x y
  46.   x=x1+dx
  47.   y=y1+dy
  48.   if i>frames then do
  49.     x=x2
  50.     y=y2
  51.         say "Hit At (" x  y ")"
  52.     end
  53.   'Move' x y
  54.   'Pend' x y
  55.   'Penu' x y
  56.   say x1'+'dx  y1'+'dy x y
  57.   'Shco'
  58. /*   'Undo' */
  59.   say 'Call SaveRGB('savename||right(i+startframe,3,"0")')'
  60.   Call SaveRGB(savename||right(i+startframe,3,"0"))
  61.   end
  62.  
  63. exit
  64.  
  65. SetFile: PROCEDURE           /* Select file in current requester */
  66.   arg file
  67.   dirname=GetPathName(file)
  68.   'Dnam'dirname          /* Enter file path  */
  69.   'Dsel'                 /* Hit return on directory */
  70.   'Dnam'dirname          /* Enter file path  */
  71.   'Dsel'                 /* Hit return on directory */
  72.   filename=GetFileName(file)
  73.   'Fnam'filename         /* Enter File name  */
  74.   'Okls'                 /* Hit the OK button  */
  75.   return
  76.  
  77. LoadFrameStore: PROCEDURE   /* Load FrameStore */
  78.   arg filename           /* must have ###.fs on front! */
  79.   'Loco'                 /* Call file requester  */
  80.   'Fnam'filename         /* Enter File name  */
  81.   'Okls'                 /* Hit the OK button  */
  82.   return 0
  83.  
  84. SaveFrameStore: PROCEDURE   /* Save FrameStore */
  85.   arg filename           /* must have ###.fs on front! */
  86.   'Saco'                 /* Call file requester  */
  87.   'Fnam'filename         /* Enter File name  */
  88.   'Okls'                 /* Hit the OK button  */
  89.   return 0
  90.  
  91. LoadRGB: PROCEDURE   /* Load IFF RGB, copy into swap buffer */
  92.   arg filename
  93.   'Lo24'                 /* Call file requester  */
  94.     Call SetFile(filename)
  95.   return
  96.  
  97. SaveRGB: PROCEDURE   /* Save IFF RGB, copy into swap buffer */
  98.   arg filename
  99.   'Sa24'                 /* Call file requester  */
  100.     Call SetFile(filename)
  101.   return
  102.  
  103. GetFileName: procedure  /* Extract file name from full file specification */
  104.   ARG fullfile
  105.   c = lastpos("/",fullfile)
  106.   if c = 0 then c = lastpos(":",fullfile)
  107.   return substr(fullfile, c + 1)
  108.  
  109. GetPathName: procedure  /* Extract directory name from full file specification */
  110.   ARG fullfile
  111.   c = lastpos("/",fullfile)
  112.   if c = 0 then c = lastpos(":",fullfile)
  113.   return left(fullfile,c)
  114.  
  115.  
  116.